package emulator.unittest.hardware.io.peripherals.iec;

import static org.junit.Assert.*;

import java.nio.ByteBuffer;

import org.junit.Test;

import emulator.hardware.io.peripherals.iec.FsDirectory;


public class FsDirectoryTest {
	
	@Test
	public void testConstruction()
	{
		FsDirectory dir = new FsDirectory();
		ByteBuffer buffer = ByteBuffer.allocate(1000);
		dir.getDirectory(buffer);
		buffer.flip();
		assertFalse(buffer.hasRemaining());
	}
	
	@Test
	public void testLoadDirectory()
	{
		FsDirectory dir = new FsDirectory();
		dir.load(".");
		ByteBuffer buffer = ByteBuffer.allocate(1000);
		dir.getDirectory(buffer);
		buffer.flip();
		assertTrue(buffer.hasRemaining());
		dir.unload();
		dir.getDirectory(buffer);
		buffer.flip();
		assertFalse(buffer.hasRemaining());
	}
}
